/*
 * =====================================================================================
 *
 *       Filename:  CppKeywords.cpp
 *
 *    Description:
 *
 *        Version:  1.0
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Yt(fndisme), fndisme@163.com
 *   Organization:
 *
 * =====================================================================================
 */
#include <iostream>
/* key words of cpp
 * alignas （C++11 起） alignof （C++11 起） and and_eq
 * asm  auto  bitand  bitor  bool  break  case catch
 * char  char16_t（C++11 起） char32_t（C++11 起） class
 * compl  concept （概念TS）  const  constexpr（C++11 起） const_cast
 * continue decltype（C++11 起）  default delete  do
 * double dynamic_cast else enum explicit export extern false float
 * for friend goto if inline int long mutable namespace new
 * noexcept（C++11 起） not not_eq nullptr （C++11 起）operator
 * or or_eq private protected public register reinterpret_cast requires（概念TS）
 * return short signed sizeof static static_assert（C++11 起） static_cast
 * struct switch template this thread_local（C++11 起） throw
 * true try typedef typeid typename union unsigned using（1） virtual
 * void volatile wchar_t while xor xor_eq
 * */
/* aggregate initialization */
void aggregateInit() {
	char a[]= "abc";
	char b[5]{"abc"};
	wchar_t c[] = {L"abc"};
}

int f(bool b) {
  int x;                // OK: the value of x is indeterminate
  int y = x;            // undefined behavior
	std::cout << "x y " << x << " " << y << std::endl;
  unsigned char c;      // OK: the value of c is indeterminate
  unsigned char d = c;  // OK: the value of d is indeterminate
  std::cout << "c d " << static_cast<int>(c) << " " << static_cast<int>(d)
            << std::endl;
  int e = d;            // undefined behavior
  return b ? d : 0;     // undefined behavior if b is true
}

struct A {
  int i;
  A() {}  // user-provided default ctor, does not initialize i
};

struct B {
  A a;
};  // implicitly-defined default ctor

void testB() {
std::cout << B().a.i << '\n';
int* pa = new int;
int* pb = new int();
std::cout << "pa pb" << *pa << " " << *pb << std::endl;
delete pa;
delete pb;
}

void f(int,int) {}

void undefinedBehavour() {
	int i = 10;
	i = ++i + i++;
	i = i++ + 1;
	f(++i, ++i);
	f(i = -1, i = -1);

}


int* p;
int main(int,char**argv) {
	//auto w = f(true);
	//std::cout << "w is " << w << std::endl;
	//testB();
}
